package com.pgybook.db.entity.mapper;

import org.springframework.stereotype.Repository;
import com.pgybook.db.entity.domain.OrderDailyAnalysis;
import com.pgybook.db.entity.domain.OrderDailyAnalysisEx;
import com.pgybook.db.entity.domain.OrderDailyAnalysisKey;

import java.util.List;

import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.ResultMap;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

@Repository
public interface OrderDailyAnalysisMapper {
    int countByExample(OrderDailyAnalysisEx example);

    int deleteByExample(OrderDailyAnalysisEx example);

    @Delete({
            "delete from orderdailyanalysis",
            "where LIBID = #{libid,jdbcType=INTEGER}",
            "and BZDAY = #{bzday,jdbcType=DATE}"
    })
    int deleteByPrimaryKey(OrderDailyAnalysisKey key);

    @Insert({
            "insert into orderdailyanalysis (LIBID, BZDAY, ",
            "ORDERNUM, BOOKNUM, ",
            "AVGDELIVERTIME)",
            "values (#{libid,jdbcType=INTEGER}, #{bzday,jdbcType=DATE}, ",
            "#{ordernum,jdbcType=INTEGER}, #{booknum,jdbcType=INTEGER}, ",
            "#{avgdelivertime,jdbcType=INTEGER})"
    })
    int insert(OrderDailyAnalysis record);

    int insertSelective(OrderDailyAnalysis record);

    List<OrderDailyAnalysis> selectByExample(OrderDailyAnalysisEx example);

    @Select({
            "select",
            "LIBID, BZDAY, ORDERNUM, BOOKNUM, AVGDELIVERTIME",
            "from orderdailyanalysis",
            "where LIBID = #{libid,jdbcType=INTEGER}",
            "and BZDAY = #{bzday,jdbcType=DATE}"
    })
    @ResultMap("BaseResultMap")
    OrderDailyAnalysis selectByPrimaryKey(OrderDailyAnalysisKey key);

    int updateByExampleSelective(@Param("record") OrderDailyAnalysis record, @Param("example") OrderDailyAnalysisEx example);

    int updateByExample(@Param("record") OrderDailyAnalysis record, @Param("example") OrderDailyAnalysisEx example);

    int updateByPrimaryKeySelective(OrderDailyAnalysis record);

    @Update({
            "update orderdailyanalysis",
            "set ORDERNUM = #{ordernum,jdbcType=INTEGER},",
            "BOOKNUM = #{booknum,jdbcType=INTEGER},",
            "AVGDELIVERTIME = #{avgdelivertime,jdbcType=INTEGER}",
            "where LIBID = #{libid,jdbcType=INTEGER}",
            "and BZDAY = #{bzday,jdbcType=DATE}"
    })
    int updateByPrimaryKey(OrderDailyAnalysis record);
}
